$(document).ready(function(){
	var baseurl = $('#baseurl').val();
	var uid = $('#uid').val();
	var buttonText = $('#btn_text').val();
	var fileExt = '*.avi;*.flv;*.3gp;*.3g2;*.mov;*.mp4;*.mpeg;*.swf;*.vob;*.wmv';
	var fileDesc = 'Video Files';
	var old_video = $('#cdbase_video').val();
	var html ='';

	$("#eu-video-submit").click(function(){
		if($('#file_uploadQueue').html() == ''){
			$('.error-r').html("Choose video first.").fadeIn(1000);
		}else{
			$('#file_upload').uploadifyUpload();
		}

		return false;
	});
	$('#file_upload').uploadify({
		'uploader'    : baseurl+'assets/js/uploadify/uploadify.swf',
		'script'      : baseurl+'profile/upload_video',
		'cancelImg'   : baseurl+'assets/js/uploadify/cancel.png',
		'folder'      : '/eulogy_video',
		'scriptData'  : {'userid':uid,'old_video':old_video},
		'buttonText' : buttonText,
		'removeCompleted' : true,
		'multi'           : true,
		'fileExt'     : fileExt,
		'fileDesc'    : fileDesc,
		'queueSizeLimit' : 1,
		'auto' : false,
		'onAllComplete'  : function(event, ID, fileObj, response, data) {
			$('.error-r').html("Successfully uploaded video").fadeIn(1000,function(){
				window.location.href = baseurl+'profile/eulogy_video';
			});
		}
	});

});

